class WeatherType {
  static const int sunny = 0; //晴Sunny
  static const int cloudy = 1; //多云Cloudy
  static const int overcast = 2; //阴Overcast
  static const int shower = 3; //阵雨Shower
  static const int thundershower = 4; //雷阵雨T-storm
  static const int thundershowerWithHail = 5; //雷阵雨伴有冰雹T-storm with hail
  static const int sleet = 6; //雨夹雪storm
  static const int lightRain = 7; //小雨Light rain
  static const int moderateRain = 8; //中雨Moderate rain
  static const int heavyRain = 9; //大雨Heavy rain
  static const int storm = 10; //暴雨Storm
  static const int heavyStorm = 11; //大暴雨Heavy storm
  static const int severeStorm = 12; //特大暴雨Severe storm
  static const int snowFlurry = 13; //阵雪Flurry
  static const int lightSnow = 14; //小雪Light snow
  static const int moderateSnow = 15; //中雪Moderate snow
  static const int heavySnow = 16; //大雪heavy snow
  static const int snowStorm = 17; //暴雪Blizzard
  static const int foggy = 18; //雾Fog
  static const int iceRain = 19; //冻雨Ice rain
  static const int dustStorm = 20; //沙尘暴Dust storm
  static const int lightToModerateRain = 21; //小到中雨Light to moderate rain
  static const int moderateToHeavyRain = 22; //中到大雨Moderate to heavy rain
  static const int heavyRainToStorm = 23; //大到暴雨Heavy rain
  static const int stormToHeavyStorm = 24; //暴雨到大暴雨Storm to heavy storm
  static const int heavyToSevereStorm = 25; //大暴雨到特大暴雨Heavy storm to severe storm
  static const int lightToModerateSnow = 26; //小到中雪Light to moderate snow
  static const int moderateToHeavySnow = 27; //中到大雪Moderate to heavy snow
  static const int heavySnowToSnowstorm = 28; //大到暴雪Heavy snow to severe snow
  static const int dust = 29; //浮尘Dust
  static const int sand = 30; //扬沙Sand
  static const int sandstorm = 31; //强沙尘暴Heavy sandstorm
  static const int haze = 53; //霾Haze
  static const int unknown = 99; //无Unknown

  /// 思华接口的天气类型
  static const int clear = 0; //晴天
  static const int clouds = 1; //多云
  static const int drizzle = 2; //小雨
  static const int rain = 3; //雨
  static const int snow = 4; //雪
  static const int thunderStorm = 5; //雷雨
  static const int mist = 6; //雾
  static const int smoke = 7; //烟雾
  // static const int haze = 8; //薄雾
  static const int fog = 9; //雾
  // static const int sand = 10; //砂层
  // static const int dust = 11; //灰尘
  static const int ash = 12; //灰
  static const int squall = 13; //暴风
  static const int tornado = 14; //龙卷风

  static getWeatherIcon(String? weather) {
    if (weather == null || weather.isEmpty) {
      return '999.svg';
    }
    var lowCase = weather.toLowerCase();
    switch (lowCase) {
      case 'haze':
        return '502.svg';
      case 'fog':
        return '501.svg';
      case 'sand':
        return '503.svg';
      case 'dust':
        return '504.svg';
      case 'mist':
        return '500.svg';
      case 'tornado':
        return '1002.svg';
      case 'squall':
        return '2201.svg';
      case 'overcast':
      case '阴':
        return '104.svg';
      case 'sunny':
      case 'clear':
      case 'clear sky':
        return '100.svg';
      case 'cloudy':
      case 'clouds':
      case 'partly cloudy':
      case 'few clouds':
      case 'overcast clouds':
      case 'broken clouds':
      case 'scattered clouds':
      case '多云':
        return '101.svg';
      case 'light rain':
        return '305.svg';
      case 'moderate rain':
      case 'heavy intensity rain':
      case 'extreme rain':
      case 'freezing rain':
      case 'light intensity shower rain':
      case 'shower rain':
      case 'heavy intensity shower rain':
      case 'ragged shower rain':
        return '306.svg';
      case 'rain':
        return '399.svg';
      case 'drizzle':
      case 'light intensity drizzle':
      case 'heavy intensity drizzle':
      case 'light intensity drizzle rain':
      case 'drizzle rain':
      case 'heavy intensity drizzle rain':
      case 'shower rain and drizzle':
      case 'heavy shower rain and drizzle':
      case 'shower drizzle':
        return '309.svg';
      case 'snow':
      case 'sleet':
      case 'heavy shower snow':
      case 'shower snow':
      case 'light shower snow':
      case 'rain and snow':
      case 'light rain and snow':
      case 'shower sleet':
      case 'light shower sleet':
      case 'heavy snow':
      case 'light snow':
        return '499.svg';
      case 'thunderstorm with light rain':
      case 'thunderstorm with rain':
      case 'thunderstorm with heavy rain':
      case 'light thunderstorm':
      case 'thunderstorm':
      case 'heavy thunderstorm':
      case 'ragged thunderstorm':
      case 'thunderstorm with light drizzle':
      case 'thunderstorm with drizzle':
      case 'thunderstorm with heavy drizzle':
        return '303.svg';
      default:
        return '999.svg';
    }
  }

  static getType(String s) {
    var lowCase = s.toLowerCase();
    switch (lowCase) {
      case 'haze':
        return haze;
      case 'sand':
        return sand;
      case 'dust':
        return dust;
      case 'sunny':
      case 'clear':
      case 'clear sky':
      case '晴':
        return sunny;
      case 'cloudy':
      case 'clouds':
      case 'partly cloudy':
      case 'few clouds':
      case 'overcast clouds':
      case 'broken clouds':
      case 'scattered clouds':
      case '多云':
        return cloudy;
      case 'overcast':
      case '阴':
        return overcast;
      case 'shower':
      case '阵雨':
        return shower;
      case 'thundershower':
      case '雷阵雨':
        return thundershower;
      case 'moderate rain':
        return moderateRain;
      case 'light rain':
      case 'lightRain':
      case 'drizzle':
      case '小雨':
        return lightRain;
      case 'heavy rain':
      case 'heavyrain':
      case '大雨':
        return heavyRain;
      case 'snow':
      case 'light snow':
        return lightSnow;
      case 'fog':
        return foggy;
      default:
        return unknown;
    }
  }
}
